//
//  YHPStatusBottomView.swift
//  SinaSwift
//
//  Created by Yan on 16/3/15.
//  Copyright © 2016年 baidu. All rights reserved.
//

import UIKit
import SnapKit

class YHPStatusBottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor(white: 0.9, alpha: 1)
        setUpUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    //MARK: 按钮的监听事件
    @objc private func repostBtnClick() {
        //页面跳转
        let temp = YHPTempViewController()
        //设置底部tabbar隐藏
        temp.hidesBottomBarWhenPushed = true
        //使用导航视图控制 跳转页面
        navController()?.pushViewController(temp, animated: true)
        
    }

    private func setUpUI () {
        
        addSubview(repostBtn)
        repostBtn.addTarget(self, action: #selector(YHPStatusBottomView.repostBtnClick), forControlEvents: .TouchUpInside)
        addSubview(commentBtn)
        addSubview(praiseBtn)
        addSubview(separatorOne)
        addSubview(separatorTwo)
        
        
        repostBtn.snp_makeConstraints { (make) -> Void in
            make.left.bottom.top.equalTo(self)
        }
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.top.bottom.equalTo(self)
            make.left.equalTo(repostBtn.snp_right)
            make.width.equalTo(repostBtn.snp_width)
        }
        praiseBtn.snp_makeConstraints { (make) -> Void in
            make.top.bottom.right.equalTo(self)
            make.left.equalTo(commentBtn.snp_right)
            make.width.equalTo(commentBtn.snp_width)
        }
        separatorOne.snp_makeConstraints { (make) -> Void in
            make.width.equalTo(0.5)
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(0.5)
            make.left.equalTo(repostBtn.snp_right)
        }
        separatorTwo.snp_makeConstraints { (make) -> Void in
            make.width.equalTo(0.5)
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(0.5)
            make.left.equalTo(commentBtn.snp_right)
        }
        separatorOne.backgroundColor = UIColor.blackColor()
        separatorTwo.backgroundColor = UIColor.blackColor()
        
        
        
        
    }
    
    lazy var separatorOne: UIImageView = UIImageView()
    
    lazy var separatorTwo: UIImageView = UIImageView()
    lazy var repostBtn: UIButton = UIFactory.factoryButtonWithTitle("转发", fontSize: 16, titleColor: commonColor, imageName: "timeline_icon_retweet")
    lazy var commentBtn: UIButton = UIFactory.factoryButtonWithTitle("评论", fontSize: 16, titleColor: commonColor, imageName: "timeline_icon_comment")
    lazy var praiseBtn:UIButton = UIFactory.factoryButtonWithTitle("赞", fontSize: 16, titleColor: commonColor, imageName: "timeline_icon_unlike")
}
